import Vue from "vue";
import VueRouter from "vue-router";

import Layout from '@/layout/TheLayout';
import EmptyLayout from "@/layout/EmptyLayout";


Vue.use(VueRouter);


const routes = [{
    path: '/',
    redirect: '/login'
},
{
    path: '/login',
    name: 'login',
    component: () => import('@/views/login'),
    meta: {
        title: '登录',
        requireAuth: false
    }
},
{
    path: '/welcome',
    name: 'welcome',
    redirect: '/home',
    component: Layout,
    children: [{
        path: '/home',
        name: 'home',
        component: () => import('@/views/batchList/page/batchList.vue'),
        meta: {
            title: '案例列表',
            requireAuth: false
        }
    },
    // {
    //     path: '/batchList',
    //     name: 'batchList',
    //     component: () => import('@/views/batchList/page/batchList.vue'),
    //     meta: {
    //         title: '案例列表',
    //         requireAuth: false
    //     }
    // },
    {
        path: '/basicModule',
        name: 'basicModule',
        component: () => import('@/views/basicModule/page/index.vue'),
        meta: {
            title: '基本模块',
            requireAuth: false
        }
    },
    {
        path: '/earlyModule',
        name: 'earlyModule',
        component: () => import('@/views/earlyModule/page/index.vue'),
        meta: {
            title: '早期模块',
            requireAuth: false
        }
    },
    {
        path: '/longtermModule',
        name: 'longtermModule',
        component: () => import('@/views/longtermModule/page/index.vue'),
        meta: {
            title: '长期模块',
            requireAuth: false
        }
    },
    {
        path: '/ingestionModule',
        name: 'ingestionModule',
        component: () => import('@/views/ingestionModule/page/index.vue'),
        meta: {
            title: '食入模块',
            requireAuth: false
        }
    },
    {
        path: '/sensitivitySet',
        name: 'sensitivitySet',
        component: () => import('@/views/sensitivitySet/page/index.vue'),
        meta: {
            title: '敏感度分析设置',
            requireAuth: false
        }
    },
    {
        path: '/resultsShow',
        name: 'resultsShow',
        component: () => import('@/views/resultsShow/page/index.vue'),
        meta: {
            title: '结果展示',
            requireAuth: false
        }
    },
    {
        path: '/conginModule',
        name: 'conginModule',
        component: resolve => require(['@/views/conginModule/page/index.vue'], resolve),
        meta: {
            title: '数据字典',
            requireAuth: true
        }
    }
    ]
},
{
    path: "/error",
    component: EmptyLayout,
    redirect: "noRedirect",
    name: "Error",
    meta: {
        title: "错误页",
        icon: "bug"
    },
    children: [{
        path: "/401",
        name: "Error401",
        component: () => import("@/views/401"),
        meta: {
            title: "401"
        },
    },
    {
        path: "/404",
        name: "Error404",
        component: () => import("@/views/404"),
        meta: {
            title: "404"
        },
    },
    ],
},
{
    path: "*",
    redirect: "/404",
},
];

const router = new VueRouter({
    routes
});

export default router;